package top.hkyzf.study.leetcode.dp;

import org.junit.Test;

/**
 * description: 
 * @author zhufeng
 * @date 2024/3/25 0025 9:20
 * @version V1.0
 */
public class 零钱兑换_II_518 {
    public int change(int amount, int[] coins) {
        int[] dp = new int[amount + 1];
        dp[0] = 1;
        for (int coin : coins) {
            for (int i = coin; i <= amount; i++) {
                dp[i] += dp[i - coin];
            }
        }
        return dp[amount];
    }

    @Test
    public void testChange () {
        int amount = 5;
        int[] coins = {1,2,5};
        System.out.println(change(amount, coins));
    }
}
